Here's a good intro lesson
In [3]:
0b0 + 0b1000
Out[3]:
In [8]:
0b101
Out[8]:
In [11]:
5 << 1 # should multiply by 2 aka 10
Out[11]:
In [12]:
10 >> 1 # should devide by 2 aka 5
Out[12]:
In [23]:
~5 # ~ means bitwise not
Out[23]:
In [32]:
5 & 4 # & means bitwise and
Out[32]:
In [33]:
5 | 4 # | means or
Out[33]:
In [31]:
5 ^ 4 # ^ means xor aka exlusive or
Out[31]:
In [35]:
5 ^ 1 # property of xor.... if you xor something with the output of that item and it's previous exor valy you get the original value
Out[35]:
In [ ]: